package com.itheima.homework5;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Random;

public class Demo5_Reader {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(
                new FileReader("d13_zuoye_IO_String/name.txt"));
        ArrayList<String> list = new ArrayList<>();
        String s;
        while ((s=br.readLine())!=null){
            list.add(s);
        }
        br.close();
        Random r = new Random();
        int index = r.nextInt(list.size());
        System.out.println(list.get(index));
    }
}
